@extends(_base)
@import demo.upload.*;
@args List<SingleImage> images;

<form action="/single/by_file" method="post" enctype="multipart/form-data">
  <h3>By File</h3>
  <div class="line">
    <input type="text" name="title">
  </div>
  <div class="line">
    <input type="file" name="image">
  </div>
  <div class="line">
    <button type="submit">Upload</button>
  </div>
</form>

<form action="/single/by_sobj" method="post" enctype="multipart/form-data">
  <h3>By SObject</h3>
  <div class="line">
    <input type="text" name="title">
  </div>
  <div class="line">
    <input type="file" name="image">
  </div>
  <div class="line">
    <button type="submit">Upload</button>
  </div>
</form>


<form action="/single/by_bind" method="post" enctype="multipart/form-data">
  <h3>Direct POJO Bind</h3>
  <div class="line">
    <input type="text" name="image.title">
  </div>
  <div class="line">
    <input type="file" name="image.image">
  </div>
  <div class="line">
    <button type="submit">Upload</button>
  </div>
</form>


<hr/>
<ul id="gallery">
  @for (images) {
  <li>
      <p>@_.getTitle()</p>
      <img src="@_.getImageUrl()">
      <form action="@(_action.req().path())/@_.getId()?_method=delete" method="post">
        <button type="submit">delete</button>
      </form>
  </li>
  }
</ul>